/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package models.beans;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
 *
 * @author Hoang Dong Tien
 */
public class Contact extends org.apache.struts.action.ActionForm {
    private int contactId;
    private String fullname;
    private String email;
    private String address;
    private String phone;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getContactId() {
        return contactId;
    }

    public void setContactId(int contactId) {
        this.contactId = contactId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Contact() {
        super();
        this.contactId = 0;
        this.fullname = "";
        this.email = "";
        this.address = "";
        this.phone = "";
    }

     @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if(fullname == null || fullname.equals(""))
        {
            errors.add("fullnamenull",new ActionMessage("contact.fullname.required"));
        }
        if(email == null || email.equals(""))
        {
            errors.add("emailnull",new ActionMessage("contact.email.required"));
        }
        return errors;
    }
}
